// Decompiled by DJ v3.9.9.91 Copyright 2005 Atanas Neshkov  Date: 4/12/2007 09:14:04
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   ResourceBundleCollection.java

package utility;

import java.io.PrintStream;
import java.util.*;

// Referenced classes of package de.escape.quincunx.i18n:
//            I18n

public class ResourceBundleCollection extends ResourceBundle
{

    public void addResourceBundle(ResourceBundle bundle)
    {
        resourceBundles.addElement(bundle);
        addEntries(bundle);
    }

    public void removeResourceBundle(ResourceBundle bundle)
    {
        if(resourceBundles.removeElement(bundle))
        {
            resources = new Hashtable(89);
            for(Enumeration e = resourceBundles.elements(); e.hasMoreElements(); addEntries((ResourceBundle)e.nextElement()));
        }
    }

    private void addEntries(ResourceBundle bundle)
    {
        Object key;
        for(Enumeration e = bundle.getKeys(); e.hasMoreElements(); resources.put(key, bundle.getObject(key.toString())))
        {
            key = e.nextElement();
            if(I18n.DEBUG && resources.get(key) != null)
                System.err.println("key '" + key + "'redefined in resource bundle " + bundle);
        }

    }

    protected Object handleGetObject(String key)
    {
        return resources.get(key);
    }

    public Enumeration getKeys()
    {
        return resources.keys();
    }

    public ResourceBundleCollection()
    {
        resourceBundles = new Vector();
        resources = new Hashtable(89);
    }

    private Vector resourceBundles;
    private Hashtable resources;
}